[Unit]
Description=calico
After=docker.service

[Service]
ExecStartPre=-/bin/bash -c 'docker rm calico'
ExecStart=/bin/bash -c 'docker run --net=host  --privileged  --name=calico   --restart=always  -e NO_DEFAULT_POOLS=  -e CALICO_LIBNETWORK_ENABLED=true -e CALICO_IPV4POOL_IPIP=always  -e IP={{ NODEIP }}  -e CALICO_IPV4POOL_CIDR={{ pod_cidr }} -e CALICO_LIBNETWORK_CREATE_PROFILES=true  -e CALICO_LIBNETWORK_LABEL_ENDPOINTS=false  -e CALICO_LIBNETWORK_IFPREFIX=cali  -e NODENAME={{ inventory_hostname | lower }} -e CALICO_NETWORKING_BACKEND=bird  -e IP6_AUTODETECTION_METHOD=first-found  -e ETCD_ENDPOINTS={{ ETCD_ENDPOINTS }} -v /var/log/calico:/var/log/calico  -v /var/run/calico:/var/run/calico  -v /lib/modules:/lib/modules -v /var/lib/calico:/var/lib/calico -v /run/docker/plugins:/run/docker/plugins  -v /var/run/docker.sock:/var/run/docker.sock  goodrain.me/{{ calico_image }}'
ExecStop=/bin/bash -c 'docker stop calico'
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target